import ajax from './request.config'

export const getQiniuToken = () => ajax.get('/qiniu/uploadToken')
    /**
     * 侧边栏权限
     */
export const getMenu = () => ajax.get('/menu/getMenu')
    /**
     * 总数据
     */
export const getTotalData = () => ajax.get('/overview/indexList')
    /**
     * 工作台
     */
export const getWorkbench = () => ajax.get('/overview/workbenchList')
    //状态总览
    //本月数据
export const getNearlyMonthData = () => ajax.get('/overview/monthData')
    //故障设备类型Top5
export const getfaultEquip = () => ajax.get('overview/faultpiechart')
export const getfaultInst = () => ajax.get('overview/orgpiechart')
export const getfaultCount = () => ajax.get('overview/monthRepair')

export const getpurchaseHM = () => ajax.get('overview/sixOrderTotal')
export const getpurchaseC = () => ajax.get('overview/orderNum')
export const getpurchaseM = () => ajax.get('overview/orderTotal')

export const getPZpurchaseHM = () => ajax.get('overview/sixApplicationTotal')
export const getPZpurchaseC = () => ajax.get('overview/applicationNum')
export const getPZpurchaseM = () => ajax.get('overview/applicationTotal')

/**
 * 用户的机构树
 */
export const getOrgTree = (uuid, province, city, district) => ajax.get('/instmanage/orgTree', { params: { uuid, province, city, district } })
    /**根据客户uuid查询和其有关联的所有人员 */
export const getAllPeoByCusUuid = customer_uuid => ajax.get('/urgentGroup/customerList', { params: { customer_uuid } })
    /**设备维修进度和预警 */
export const getWarningTree = () => ajax.get('/warningmanage/index')

/**地区 */
export const getAreaData = () => ajax.get('/area/allregion')

/**获取所有客户列表 */
export const getBankCustomer = () => ajax.get('/instmanage/bankCustomer')

/**获取指定客户机构列表 */
export const getBankOrg = (customerUuid, province, city, district) => ajax.get('/instmanage/bankOrg', { params: { customerUuid, province, city, district } })

/**根据设备编号获取设备信息 */
export const getEquipInfo = equip_code => ajax.get('/warningmanage/checkEquip', { params: { equip_code } })

/**根据手机号获取用户信息 */
export const getUserInfoByMobile = mobile => ajax.get('/warningmanage/checkMobile', { params: { mobile } })

/**根据维修单号获取信息 */
export const getInfoByReapireNum = uuid => ajax.get('/repository/getWarningDetail', { params: { uuid } })

export const getCustomerListByLocation = (province, city, district) => ajax.get('/instmanage/bankCustomerAttribute', {
    params: { province, city, district }
})
export const getRepaireDetails = uuid => ajax.get('/warningmanage/view', { params: { uuid } })
    /**进度 */
export const getRepaireProgress = uuid => ajax.get('/warningmanage/operationList', { params: { uuid } })
export const getRepaireProgressTotalTime = uuid => ajax.get('/warningmanage/timeDifference', { params: { uuid } })
    /**配件更换 */
export const getpurchase = uuid => ajax.get('/warningmanage/purchaseDetailList', { params: { uuid } })

/**分配转介记录 */
export const getRecords = uuid => ajax.get('/warningmanage/recordList', { params: { uuid } })
    /**分配人员 */
export const getFPPros = (uuid, inst_uuid) => ajax.get('/warningmanage/distribution', { params: { uuid, inst_uuid } })

//设备维修
export const tableToExcelRepaire = () => ajax.get('/warningmanage/download')


/**场地巡检 进度预警*/
export const getInspec = () => ajax.get('/inspection/index')
    /**详情inspection/view */
export const getInspectionDetails = uuid => ajax.get('/inspection/view', { params: { uuid } })
    /**分配记录 */
export const getInspectionRecords = uuid => ajax.get('/inspection/recordList', { params: { uuid } })
    /**巡检模板列表 */
export const gettemplateList = inst_uuid => ajax.get('/inspection/chooseInspectionTemplate', { params: { inst_uuid } })
export const getProsByCustomer = inst_uuid => ajax.get('/inspection/distribute', { params: { inst_uuid } })
    /**场地巡检进度 */
export const getInspecProgress = uuid => ajax.get('/inspection/operationList', { params: { uuid } })
export const getInspectionProTime = uuid => ajax.get('/inspection/timeDifference', { params: { uuid } })
    /**分配 */
export const getInspRecords = uuid => ajax.get('/inspection/recordList', { params: { uuid } })
export const getInspecPros = (uuid, inst_uuid) => ajax.get('/inspection/distribute', { params: { uuid, inst_uuid } })
export const getInspecReport = uuid => ajax.get('/inspection/report', { params: { uuid } })
export const downloadInspection = () => ajax.get('/inspection/download')

//办公用品
export const getGoodsCondition = () => ajax.get('/goodsOrder/goList')
export const getGoodsDetails = uuid => ajax.get('/goodsOrder/detail', { params: { uuid } })
export const getGoodsProgress = uuid => ajax.get('/goodsOrder/operationList', { params: { uuid } })

//凭证请领
export const getVoucherCondition = () => ajax.get('/voucherApply/goList')
export const getVoucherDetail = uuid => ajax.get('/voucherApply/detail', { params: { uuid } })
export const getVoucherProgress = uuid => ajax.get('/voucherApply/operationList', { params: { uuid } })
    //维修记录
export const getReRecords = ({
    orderNumber,
    customerUuid,
    instUuid,
    state,
    province,
    city,
    district,
    pageNumber,
    pageSize
}) => ajax.get('/repairrecord/list', {
    params: {
        orderNumber,
        customerUuid,
        instUuid,
        state,
        province,
        city,
        district,
        pageNumber,
        pageSize
    }
})
export const getReReDetails = orderNumber => ajax.get('/repairrecord/details', { params: { orderNumber } })
    //应急响应
export const getEmResTable = ({
    key,
    customer_uuid,
    inst_uuid,
    status,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/urgent/list', {
    params: {
        key,
        customer_uuid,
        inst_uuid,
        status,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})
export const getEventDetail = uuid => ajax.get('/urgent/detail', { params: { uuid } })
export const getDiscuss = uuid => ajax.get('/urgent/discuss', { params: { uuid } })
export const getDiscussCon = uuid => ajax.get('/urgent/logList', { params: { uuid } })

//内容管理
//Banner
export const getBannerList = (pageSize, pageNumber) => ajax.get('/banner/list', { params: { pageSize, pageNumber } })
export const editBanner = uuid => ajax.get('/banner/goEdit', { params: { uuid } })

//知识库
export const getKnowledgeCondition = () => ajax.get('/repository/index')
    //消息管理

//用户反馈
export const getFeedbackCondition = () => ajax.get('/userfeedback/index')
export const viewPosition = uuid => ajax.get('/userfeedback/positionerrorview', { params: { uuid } })
export const viewOpinion = uuid => ajax.get('/userfeedback/opinionview', { params: { uuid } })
    //巡检模板
export const getUserInfoList = (pageSize, pageNumber, uuid) => ajax.get('/inspectiontemplate/usagelist', { params: { pageSize, pageNumber, uuid } })
export const getTempDetails = uuid => ajax.get('/inspectiontemplate/detail', { params: { uuid } })

//机构
export const getOrgTreeData = instName => ajax.get('instmanage/orgTreeWithState', { params: { instName } })
export const getLeafInfo = uuid => ajax.get('/instmanage/nodeInfo', { params: { uuid } })
export const getLeafPartInfo = bankUuid => ajax.get('/instmanage/listDepartment', { params: { bankUuid } })
export const getAss = (uuid, city) => ajax.get('/instmanage/assign', { params: { uuid, city } })

//报修人
export const getPower = () => ajax.get('/bankcustomer/power')
    //根据机构查询其旗下部门
export const getDeptList = inst_uuid => ajax.get('/instmanage/deptAttribute', { params: { inst_uuid } })


//服务商架构
export const getSerPartTree = instUuid => ajax.get('/servicemanager/serviceTree', { params: { instUuid } })
export const getSerPart = (instUuid, pageNumber, pageSize) => ajax.get('servicemanager/deptList', { params: { instUuid, pageNumber, pageSize } })
export const getSerPartPro = (instUuid) => ajax.get('/servicemanager/choseManager', { params: { instUuid } })

//运维人员
//根据客户uuid查询其所有服务商
export const getAllServiceByCustomer = customerUuid => ajax.get('/instmanage/ofService', { params: { customerUuid } })
    //根据服务商uuid查询其所有客户
export const getAllCustomerByService = (serviceUuid, city) => ajax.get('/instmanage/ofCustomer', { params: { serviceUuid, city } })
export const getProInfoByProUuid = uuid => ajax.get('/customermanage/edit', { params: { uuid } })
export const getConCusTable = (uuid, pageNumber, pageSize) => ajax.get('/customermanage/customerlist', { params: { uuid, pageNumber, pageSize } })
export const getCanConCusList = (uuid, partnerCode, province, city, pageNumber, pageSize) => ajax.get('/customermanage/chosePartner', { params: { uuid, partnerCode, province, city, pageNumber, pageSize } })
export const getProPosition = uuid => ajax.get('/customermanage/current', { params: { uuid } })
export const getOperatorsTable = ({
        name,
        serviceUuid,
        deptUuid,
        isBusy,
        customerUuid,
        qstate,
        province,
        city,
        district,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }) => ajax.get('/customermanage/list', {
        params: {
            name,
            serviceUuid,
            deptUuid,
            isBusy,
            customerUuid,
            qstate,
            province,
            city,
            district,
            startTime,
            endTime,
            pageNumber,
            pageSize
        }
    })
    //待审核运维
export const getDaiProTable = ({
    name,
    serviceUuid,
    province,
    city,
    district,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/customermanage/notApprovedList', {
    params: {
        name,
        serviceUuid,
        province,
        city,
        district,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})

//应急分组
export const getemgroupTable = ({
    title,
    customer_uuid,
    member_mobile,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/urgentGroup/list', {
    params: {
        title,
        customer_uuid,
        member_mobile,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})

export const getEmerGroupDetail = uuid => ajax.get('/urgentGroup/detail', { params: { uuid } })
export const getUrgGroupList = customer_uuid => ajax.get('/urgent/groupList', { params: { customer_uuid } })


//设备列表
export const getEquipType = () => ajax.get('/equip/EquipType')
export const getEquipTable = ({
        inst,
        bussinessUuid,
        type_cd,
        name,
        customerUuid,
        startTime,
        endTime,
        status,
        source,
        pageNumber,
        pageSize
    }) => ajax.get('/equip/list', {
        params: {
            inst,
            bussinessUuid,
            type_cd,
            name,
            customerUuid,
            startTime,
            endTime,
            status,
            source,
            pageNumber,
            pageSize
        }
    })
    //获取设备二维码
export const getQRcode = uuid => ajax.get('/equip/rcode', { params: { uuid } })
    //下载二维码
export const downloadQR = ({ uuid, name }) => ajax.get('/equip/exportRcode', { params: { uuid, name } })

export const getEquipRepaireRecords = (uuid, pageNumber, pageSize) => ajax.get('/equip/repairList', { params: { uuid, pageNumber, pageSize } })
export const getEquipTransferRecords = (uuid, pageNumber, pageSize) => ajax.get('/equip/operationList', { params: { uuid, pageNumber, pageSize } })

//批量新增
export const getplEquipTable = ({
        type_cd,
        code,
        inst,
        bussines,
        customerUuid,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }) => ajax.get('/equip/blankList', {
        params: {
            type_cd,
            code,
            inst,
            bussines,
            customerUuid,
            startTime,
            endTime,
            pageNumber,
            pageSize
        }
    })
    //设备类型
export const getTypeEquipTable = ({
    equipName,
    nName,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/equipType/equipTypelist', {
    params: {
        equipName,
        nName,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})
export const getSubType = (parentids, pageNumber, pageSize) => ajax.get('/equipType/childList', { params: { parentids, pageNumber, pageSize } })
    //数据统计-维修统计
export const getFaultTypeData = ({
    year,
    month,
    week,
    startTime,
    endTime
}) => ajax.get('/repaircount/faultType', {
    params: {
        year,
        month,
        week,
        startTime,
        endTime
    }
})
export const getEpTableData = ({
    year,
    month,
    week,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/repaircount/equipType', {
    params: {
        year,
        month,
        week,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})
export const getDotTableData = ({
    year,
    month,
    week,
    startTime,
    endTime,
    pageNumber,
    pageSize,
    customerUuid,
    province,
    city,
    district
}) => ajax.get("/repaircount/orgFault", {
    params: {
        year,
        month,
        week,
        startTime,
        endTime,
        pageNumber,
        pageSize,
        customerUuid,
        province,
        city,
        district
    }
})
export const getDealWayData = ({
        year,
        month,
        week,
        startTime,
        endTime,
        customerUuid,
        province,
        city,
        district
    }) => ajax.get("/repaircount/processingMethod", {
        params: {
            year,
            month,
            week,
            startTime,
            endTime,
            customerUuid,
            province,
            city,
            district
        }
    })
    //数据统计-办公用品
export const getDataOffTable = ({
        orderNumber,
        customerUuid,
        inst_uuid,
        state,
        province,
        city,
        district,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }) => ajax.get('/goodsClassification/list', {
        params: {
            orderNumber,
            customerUuid,
            inst_uuid,
            state,
            province,
            city,
            district,
            startTime,
            endTime,
            pageNumber,
            pageSize
        }
    })
    //数据统计-凭证请领
export const getDataPZTable = ({
    orderNumber,
    customerUuid,
    inst_uuid,
    state,
    province,
    city,
    district,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/voucherGoods/list', {
    params: {
        orderNumber,
        customerUuid,
        inst_uuid,
        state,
        province,
        city,
        district,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})